package cate.game.play.skill.passive.fairy;

import cate.common.table.d.GDSkill;
import cate.common.util.XT;
import cate.game.play.base.TargetSelector;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;
import cate.game.play.skill.passive.PassiveHandler;

import java.util.List;

/**
 * "渴血"额外对周围1个随机目标造成同等伤害和效果
 */
public class 战斧牛排灵器PH extends PassiveHandler {

	private String 技能标签;

	private int 人数;

	//技能标签=渴血&人数=1
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		技能标签 = args.get("技能标签");
		人数 = args.getInt("人数", 1);
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (!skill.cfg.containTag(技能标签)) {
			return;
		}
		List<Fighter> targets = TargetSelector.findRetargetTargets(action.getTeamVs(), GDSkill.Retarget.OTHER, action.getTargets());
		XT.randomPick(targets, 人数, false);
		action.getTargets().addAll(targets);
	}
}
